package edu.ccut.titan.tag.report.tag;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;

import edu.ccut.titan.tag.report.design.SeriesInfo;

public class TitanSeriesTag extends TagSupport {
	private static final long serialVersionUID = 1L;
	private String value;
	private String category;
	private String series;
	private String key;
	private String valuetype;
	private String categorytype;
	private String seriestype;
	private String keytype;
	private TitanReportChartTag reportChart;

	public String getValuetype() {
		return valuetype;
	}

	public void setValuetype(String valuetype) {
		this.valuetype = valuetype;
	}

	public String getCategorytype() {
		return categorytype;
	}

	public void setCategorytype(String categorytype) {
		this.categorytype = categorytype;
	}

	public String getSeriestype() {
		return seriestype;
	}

	public void setSeriestype(String seriestype) {
		this.seriestype = seriestype;
	}

	@Override
	public int doStartTag() throws JspException {
		reportChart = (TitanReportChartTag) this.getParent();
		SeriesInfo seriesInfo = new SeriesInfo();
		if (!"".equals(category) && category != null) {
			seriesInfo.setCategory(category);
		}
		if (!"".equals(series) && series != null) {
			seriesInfo.setSeries(series);
		}
		if (!"".equals(value) && value != null) {
			seriesInfo.setValue(value);
		}
		if (!"".equals(categorytype) && categorytype != null) {
			seriesInfo.setCategorytype(categorytype);
		}
		if (!"".equals(seriestype) && seriestype != null) {
			seriesInfo.setSeriestype(seriestype);
		}
		if (!"".equals(valuetype) && valuetype != null) {
			seriesInfo.setValuetype(valuetype);
		}
		if (!"".equals(key) && key != null) {
			seriesInfo.setKey(key);
		}
		if (!"".equals(keytype) && keytype != null) {
			seriesInfo.setKeytype(keytype);
		}
		reportChart.addSeriesInfo(seriesInfo);
		return EVAL_BODY_INCLUDE;
	}

	@Override
	public int doEndTag() throws JspException {
		return SKIP_BODY;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public String getCategory() {
		return category;
	}

	public void setCategory(String category) {
		this.category = category;
	}

	public String getSeries() {
		return series;
	}

	public void setSeries(String series) {
		this.series = series;
	}

	public String getKey() {
		return key;
	}

	public void setKey(String key) {
		this.key = key;
	}

	public String getKeytype() {
		return keytype;
	}

	public void setKeytype(String keytype) {
		this.keytype = keytype;
	}

}